package com.feng.d16openclosedprinciple.goodsmell;

import com.feng.d16openclosedprinciple.badsmell.AlertRule;
import com.feng.d16openclosedprinciple.badsmell.Notification;
import com.feng.d16openclosedprinciple.badsmell.NotificationEmergencyLevel;

/**
 * @author LiYilin on 2020/4/11
 */
public class ErrorAlertHandler extends AbstractAlertHandler {

    public ErrorAlertHandler(AlertRule rule, Notification notification) {
        super(rule, notification);
    }

    @Override
    public void check(ApiStatInfo apiStatInfo) {
        if (apiStatInfo.getErrorCount() > rule.getMatchedRule(apiStatInfo.getApi())) {
            notification.notify(NotificationEmergencyLevel.SEVERE, "...");
        }
    }
}
